package com.chixing.dao.impl;

import com.chixing.dao.RowMapper;
import com.chixing.entity.Department;

import java.sql.ResultSet;
import java.sql.SQLException;

public class DepartmentRowMapper implements RowMapper<Department> {

    @Override
    public Department mapper(ResultSet rs) {
        Department dept=null;
        try {
            int deptno = rs.getInt(1);
            String dname = rs.getString(2);
            String loc = rs.getString(3);
            dept=new Department(deptno,dname,loc);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }

        return dept;
    }
}
